﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ValuationInterface;
using ValuationModel;

namespace ValuationDAL
{
    
    public class UsersDAL : IUsers //继承接口
    {

        #region 登录
        /// <summary>
        /// 登录
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="Account"></param>
        /// <param name="pwd"></param>
        /// <returns></returns>
        public T Login<T>(string Account, string pwd)
        {
            return DBHelper.Login<T>(Account, pwd);
        }
        #endregion

        #region 查询单个实体
        /// <summary>
        /// 查询单个实体
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="t"></param>
        /// <returns></returns>
        public List<T> GetList<T>()
        {
            return DBHelper.GetList<T>();
        }
        #endregion

        #region 根据id查询单个实体
        /// <summary>
        /// 根据id查询单个实体
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="t"></param>
        /// <returns></returns>
        public T GetEntity<T>(int id)
        {
            return DBHelper.GetEntity<T>(id);
        }
        #endregion

        #region 单个实体添加,删除，修改
        /// <summary>
        /// 单个实体添加
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="t"></param>
        /// <returns></returns>
        public bool AddEntity<T>(T t)
        {
            return DBHelper.InsertEntity<T>(t);
        }
        /// <summary>
        /// 单个实体删除
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="t"></param>
        /// <returns></returns>
        public bool DelEntity<T>(int id)
        {
            return DBHelper.DeleteEntity<T>(id);
        }
        /// <summary>
        /// 单个实体修改
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="t"></param>
        /// <returns></returns>
        public bool UpdEntity<T>(T t)
        {
            return DBHelper.UpdateEnity<T>(t);
        }
        #endregion

        #region 系统管理权限列表显示
        /// <summary>
        /// 系统管理权限列表
        /// </summary>
        /// <returns></returns>
        public List<SysAuthorityAndRoles> Authority()
        {
            string sql = "select * from [dbo].[SysAuthorityAndRoles]";
            return DBHelper.ExecuteObjects<SysAuthorityAndRoles>(sql);
        }
        #endregion
       
        #region  部门管理
        /// <summary>
        /// 单个实体添加
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="t"></param>
        /// <returns></returns>
        public bool DAddEntity<T>(T t)
        {
            return DBHelper.DInsertEntity<T>(t);
        }
        /// <summary>
        /// 单个实体删除
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="t"></param>
        /// <returns></returns>
        public bool DDelEntity<T>(int id)
        {
            return DBHelper.DDeleteEntity<T>(id);
        }

        /// <summary>
        /// 单个实体修改
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="t"></param>
        /// <returns></returns>
        public bool DUpdEntity<T>(T t)
        {
            return DBHelper.DUpdateEnity<T>(t);
        }
        #endregion

        #region  用户管理
        #region 添加不对 不带角色和部门
        #endregion
        /// <summary>
        /// 单个实体添加
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="t"></param>
        /// <returns></returns>
        public bool UAddEntity<T>(T t)
        {
            return DBHelper.UInsertEntity<T>(t);
        }
        /// <summary>
        /// 单个实体删除
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="t"></param>
        /// <returns></returns>
        public bool UDelEntity<T>(int id)
        {
            return DBHelper.UDeleteEntity<T>(id);
        }

        /// <summary>
        /// 单个实体修改
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="t"></param>
        /// <returns></returns>
        public bool UUpdEntity<T>(T t)
        {
            return DBHelper.UUpdateEnity<T>(t);
        }
        #endregion

        #region  字典管理
        /// <summary>
        /// 单个实体添加
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="t"></param>
        /// <returns></returns>
        public bool DicAddEntity<T>(T t)
        {
            return DBHelper.DicInsertEntity<T>(t);
        }
        /// <summary>
        /// 单个实体删除
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="t"></param>
        /// <returns></returns>
        public bool DicDelEntity<T>(int id)
        {
            return DBHelper.DicDeleteEntity<T>(id);
        }

        /// <summary>
        /// 单个实体修改
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="t"></param>
        /// <returns></returns>
        public bool DicUpdEntity<T>(T t)
        {
            return DBHelper.DicUpdateEnity<T>(t);
        }
        #endregion

        #region  区位勘查
        /// <summary>
        /// 单个实体添加
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="t"></param>
        /// <returns></returns>
        public bool AddEAFloors<T>(T t)
        {
            return DBHelper.InsertEALocation<T>(t);
        }
        /// <summary>
        /// 单个实体删除
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="t"></param>
        /// <returns></returns>
        public bool DelEAFloors<T>(int id)
        {
            return DBHelper.DeleteEALocation<T>(id);
        }

        /// <summary>
        /// 单个实体修改
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="t"></param>
        /// <returns></returns>
        public bool UpdEAFloors<T>(T t)
        {
            return DBHelper.UpdateEALocation<T>(t);
        }
        #endregion

        #region  小区勘查
        /// <summary>
        /// 单个实体添加
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="t"></param>
        /// <returns></returns>
        public bool InsertEAVillage<T>(T t)
        {
            return DBHelper.InsertEAVillage<T>(t);
        }
        /// <summary>
        /// 单个实体删除
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="t"></param>
        /// <returns></returns>
        public bool DeleteEAVillage<T>(int id)
        {
            return DBHelper.DeleteEAVillage<T>(id);
        }

        /// <summary>
        /// 单个实体修改
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="t"></param>
        /// <returns></returns>
        public bool UpdateEAVillage<T>(T t)
        {
            return DBHelper.UpdateEAVillage<T>(t);
        }
        #endregion

        #region  建筑勘查
        /// <summary>
        /// 单个实体添加
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="t"></param>
        /// <returns></returns>
        public bool InsertEAFloors<T>(T t)
        {
            return DBHelper.InsertEAFloors<T>(t);
        }
      
        #endregion

        #region  室内勘查
        /// <summary>
        /// 单个实体添加
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="t"></param>
        /// <returns></returns>
        public bool InsertEAIndoor<T>(T t)
        {
            return DBHelper.InsertEAIndoor<T>(t);
        }

        #endregion

        #region  室内照片
        /// <summary>
        /// 单个实体删除
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="t"></param>
        /// <returns></returns>
        public bool PDeleteEntity<T>(int id)
        {
            return DBHelper.PDeleteEntity<T>(id);
        }
        public bool PInsertEntity<T>(T t)
        {
            return DBHelper.PInsertEnity<T>(t);
        }
        #endregion
        
        
    }
}
